/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package openclose;

import com.sun.jna.Native;
import interfaces.Winmm;
import java.util.Scanner;

/**
 *
 * @author jean
 */
public class OpenClose {

    static int op;

    public static void main(String[] args) {
        Winmm openClose = (Winmm) Native.loadLibrary("winmm.dll", Winmm.class);
        Scanner sc = new Scanner(System.in);

        do {
            System.out.println("1 - Abrir Drive | 2 - Fechar Drive | 3 - Encerrar");
            System.out.print("Opcao: ");

            op = sc.nextInt();

            switch (op) {
                case 1:
                    openClose.mciSendStringA("Set cdaudio door open wait", 0, 0, 0);
                    System.out.println("Drive Aberto...");
                    break;
                case 2:
                    openClose.mciSendStringA("Set cdaudio door closed wait", 0, 0, 0);
                    System.out.println("Drive Fechado...");
                    break;
                case 3:
                    System.out.println("Encerrado...");
                    break;
                default:
                    System.out.println("Opcao Invalida!");
                    break;
            }
        } while (op != 3);

        System.exit(0);
    }
}